<template>
  <div class="app-container">
    <el-col :span="24" class="selectform">
      <el-col :span="22">
        <el-form ref="QueryForm" :model="QueryForm">
          <el-form-item style="width: 80px;float: left;margin-right: 10px;">
            <el-select clearable v-model="QueryForm.mch_search_type" placeholder="请选择" :picker-options="pickerOptions">
              <el-option label="SN" :value="0"></el-option>
              <el-option label="ID" :value="1"></el-option>
              <el-option label="机器名称" :value="2"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item style="width: 150px;float: left;margin-right: 15px;">
            <el-input v-model="QueryForm.mch_search_value" clearable autocomplete="off" />
          </el-form-item>
          <el-form-item style="width: 100px;float: left;margin-right: 10px;">
            <el-select clearable v-model="QueryForm.user_search_type" placeholder="请选择">
              <el-option label="帐号" :value="0"></el-option>
              <el-option label="客户名称" :value="1"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item style="width: 150px;float: left">
            <el-input v-model="QueryForm.user_search_value" clearable autocomplete="off" />
          </el-form-item>
          <el-form-item label="开启状态：" style="width: 180px;float: left" label-width="90px">
            <el-select clearable v-model="QueryForm.tmp_is_open" placeholder="请选择">
              <el-option label="全部" value=""></el-option>
              <el-option label="开启" :value="true"></el-option>
              <el-option label="关闭" :value="false"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="运行状态：" style="width: 180px;float: left" label-width="90px">
            <el-select clearable v-model="QueryForm.is_alert" placeholder="请选择">
              <el-option label="全部" value=""></el-option>
              <el-option label="正常" :value="false"></el-option>
              <el-option label="异常" :value="true"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="柜内温度：" style="width: 180px;float: left" label-width="90px">
            <el-input v-model="QueryForm.box_tmp" clearable autocomplete="off" />
          </el-form-item>
          <el-form-item label="上口温度：" style="width: 180px;float: left" label-width="90px">
            <el-input v-model="QueryForm.second_tmp" clearable autocomplete="off" />
          </el-form-item>
          <el-form-item label="下口温度：" style="width: 180px;float: left" label-width="90px">
            <el-input v-model="QueryForm.third_tmp" clearable autocomplete="off" />
          </el-form-item>
          <el-button native-type="submit" type="primary" style="margin-left: 10px" icon="el-icon-search" @click="Query(true)">搜索
          </el-button>
        </el-form>
      </el-col>
      <el-col :span="2" style="text-align: right;">
        <el-button type="primary" style="margin-left: 10px" @click="paramsetdialogfun()">参数设置
        </el-button>
        <!--<el-button type="primary" style="margin-left: 10px" @click="showecharts111(QueryForm.SN)">统计报表
        </el-button>-->
      </el-col>
    </el-col>
    <el-col :span="24" class="tabledata">
      <el-table header-cell-class-name="tableheader" element-loading-spinner="el-icon-loading" element-loading-background="rgba(0, 0, 0, 0.8)" v-loading="Loading" :data="list" border fit element-loading-text="加载中···" class="lefttable" max-height="850">
        <el-table-column type="selection" width="55">
        </el-table-column>
        <el-table-column align="center" prop="mch_name" label="机器名称">
        </el-table-column>
        <el-table-column align="center" prop="mch_sn" label="SN">
        </el-table-column>
        <el-table-column align="center" prop="mch_id" label="ID">
        </el-table-column>
        <el-table-column align="center" prop="user_name" label="客户名称">
        </el-table-column>
        <el-table-column align="center" prop="user_loginname" label="帐号">
        </el-table-column>
        <el-table-column align="center" prop="tmp_is_open" label="开启状态">
          <template slot-scope="scope">
            {{ scope.row.tmp_is_open==true?'开启':'关闭' }}
        </template>
        </el-table-column>
        <el-table-column align="center" prop="box_tmp" label="当前柜内温度">
        </el-table-column>
        <el-table-column align="center" label="运行状态">
          <template slot-scope="scope">
            {{ scope.row.is_alert == true?'异常':'正常' }}
        </template>
        </el-table-column>
        <el-table-column align="center" label="状态说明">
          <template slot-scope="scope">
            {{ alert_type_str[scope.row.alert_type] }}
        </template>
        </el-table-column>
        <el-table-column align="center" label="操作">
          <template slot-scope="scope">
            <el-button type="warning" size="mini" plain @click="showecharts(scope.row.mch_sn,scope.row.mch_id)">温度曲线
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <div class="pagination">
        <el-pagination style="text-align: center" layout="prev, pager, next" small :current-page="QueryForm.page" :page-size="QueryForm.pagesize" :total="QueryForm.total" @size-change="handleSizeChange" @current-change="handleCurrentChange" />
      </div>
    </el-col>
    <div v-if="setlist!= ''">
      <el-dialog :close-on-click-modal="false" class="approvalpic" :append-to-body="true" title="参数设置" :visible.sync="paramsetdialog" width="70%">
        <el-col :span="24" class="diatitle">
          本页参数都是在开启制冷状态下的参数
        </el-col>
        <el-form :rules="rules" ref="ruleForm" class="demo-ruleForm">
          <el-col :span="24" class="dialistitlte">冷凝器散热风扇异常</el-col>
          <el-col :span="24" class="dialistbody">
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  持续时间
                </el-col>
                <el-col :span="24">
                  <div class="listinput">
                    <el-form-item prop="setlist0_alert_type">
                      <el-input clearable type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[0].alert_type" autocomplete="off" />
                    </el-form-item>
                  </div>
                  <div class="listinput_word listinput_word_right">
                    次上报
                  </div>
                </el-col>
              </div>
            </el-col>

            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器上口温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    超过
                  </div>
                  <div class="listinput">
                    <el-form-item prop="setlist0_tmp_limit_1">
                      <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[0].tmp_limit_1" />
                    </el-form-item>
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器下口温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    超过
                  </div>
                  <div class="listinput">
                    <el-form-item prop="setlist0_tmp_limit_2">
                      <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[0].tmp_limit_2" />
                    </el-form-item>
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
          </el-col>
          <el-col :span="24" class="dialistitlte">蒸发器轴流风扇异常</el-col>
          <el-col :span="24" class="dialistbody">
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle listinput_word_left">
                  持续时间
                </el-col>
                <el-col :span="24">
                  <div class="listinput">
                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[1].alert_type" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    次上报
                  </div>
                </el-col>
              </div>
            </el-col>

            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器上口温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    小于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[1].tmp_limit_1" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器上下口差值温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    小于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[1].tmp_limit_2" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器下口与柜内差值温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    大于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[1].tmp_limit_3" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
          </el-col>
          <el-col :span="24" class="dialistitlte">冷凝器散热效果低</el-col>
          <el-col :span="24" class="dialistbody">
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" style="height: 40px;line-height: 40px;" class="top1smalltitle listinput_word_left">
                  持续时间
                </el-col>
                <el-col :span="24">
                  <div class="listinput">
                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[2].alert_type" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    次上报
                  </div>
                </el-col>
              </div>
            </el-col>

            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" style="height: 40px;line-height: 40px;" class="top1smalltitle">
                  冷凝器上口温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    大于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[2].tmp_limit_1" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" style="height: 40px;" class="top1smalltitle">
                  冷凝器下口与柜内差值温度
                  减冷凝器上下口差值温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    大于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[2].tmp_limit_2" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
          </el-col>
          <el-col :span="24" class="dialistitlte">压缩机频繁启停</el-col>
          <el-col :span="24" class="dialistbody">
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" style="height: 40px;line-height: 40px;" class="top1smalltitle listinput_word_left">
                  持续时间
                </el-col>
                <el-col :span="24">
                  <div class="listinput">
                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[3].alert_type" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    次上报
                  </div>
                </el-col>
              </div>
            </el-col>

            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" style="height: 40px;" class="top1smalltitle">
                  冷凝器上口温度最高值减
                  冷凝器上口温度最低值
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    大于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[3].tmp_limit_1" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
          </el-col>
          <el-col :span="24" class="dialistitlte">压缩机未制冷</el-col>
          <el-col :span="24" class="dialistbody">
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle listinput_word_left">
                  持续时间
                </el-col>
                <el-col :span="24">
                  <div class="listinput">
                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[4].alert_type" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    次上报
                  </div>
                </el-col>
              </div>
            </el-col>

            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器上下口差值温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    小于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[4].tmp_limit_1" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
            <el-col :span="6">
              <div class="positionbody">
                <el-col :span="24" class="top1smalltitle">
                  冷凝器下口与柜内差值温度
                </el-col>
                <el-col :span="24">
                  <div class="listinput_word listinput_word_left">
                    小于等于
                  </div>
                  <div class="listinput">

                    <el-input clearable autocomplete="off" type="number" oninput="if(value.length>3)value=value.slice(0,3)" v-model.number="setlist[4].tmp_limit_2" />
                  </div>
                  <div class="listinput_word listinput_word_right">
                    ℃
                  </div>
                </el-col>
              </div>
            </el-col>
          </el-col>
          <el-col :span="24" style="text-align: center;">
            <el-button native-type="submit" type="primary" style="margin-left: 10px" @click="saveset()">保存
            </el-button>
          </el-col>
        </el-form>
        <div style="clear: both;"></div>
      </el-dialog>

    </div>
    <el-dialog :close-on-click-modal="false" class="approvalpic" :append-to-body="true" title="图表" :visible.sync="echartsdia" width="70%">
      <div style="text-align: center; margin-bottom: 20px;">
        <el-date-picker v-model="echarttime" :picker-options="pickerOptions" type="datetimerange" format="yyyy-MM-dd HH:mm:ss" value-format="yyyy-MM-dd HH:mm:ss" range-separator="至" start-placeholder="开始日期" end-placeholder="结束日期" @change="showecharts(-1)">
        </el-date-picker>
        <el-button type="primary" style="margin-left: 10px" @click="stoptemcol()">停止温控
        </el-button>
      </div>
      <div id='line1' style="width: 80%;height:500px; margin:0 auto;"></div>
    </el-dialog>

  </div>
</template>
<script>
  export default {

    data() {
      // 验证正整数
      var validateNum = (rule, value, callback) => {
        if (/^(?:[0-9]\d*)$/.test(value) == false) {
          callback(new Error("请输入正整数"));
        } else {
          callback();
        }
      }
      return {
        pickDataList: '', //el-date-picker v-model的值
        pickDate: '', // 存放getPickDate获取的数据
        pickerOptions: {
          onPick: this.getPickDate,
          disabledDate: this.disabledDate
        },
        QueryForm: {
          "isPage": true,
          "page": 0,
          "pagesize": 10,
          "issale": true,
          "serchKeyword": "",
          "mch_search_type": 0,
          "mch_search_value": "",
          "user_search_type": 0,
          "user_search_value": "",
          "tmp_is_open": '',
          "is_alert": '',
          "current": 0,
          "total": 0,
          box_tmp: '',
          second_tmp: '',
          third_tmp: '',
        },
        list: [],
        alert_type_str: [
          '未知',
          '冷凝器散热风扇异常',
          '蒸发器轴流风扇异常',
          '冷凝器散热效果低',
          '压缩机未制冷',
          '压缩机频繁启停'
        ],
        Loading: false,
        paramsetdialog: false,
        setlist: '',
        qdmchsn: '',
        qdmchid:'',
        rules: {
          setlist0_alert_type: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[0].alert_type) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist0_tmp_limit_1: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[0].tmp_limit_1) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist0_tmp_limit_2: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[0].tmp_limit_2) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist1_alert_type: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[1].alert_type) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist1_tmp_limit_1: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[1].tmp_limit_1) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist1_tmp_limit_2: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[1].tmp_limit_2) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist1_tmp_limit_3: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[1].tmp_limit_3) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist2_alert_type: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[2].alert_type) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist2_tmp_limit_1: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[2].tmp_limit_1) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist2_tmp_limit_2: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[2].tmp_limit_2) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],

          setlist3_alert_type: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[3].alert_type) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist3_tmp_limit_1: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[3].tmp_limit_1) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],

          setlist4_alert_type: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[4].alert_type) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist4_tmp_limit_1: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[4].tmp_limit_1) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],
          setlist4_tmp_limit_2: [
          {
            validator: (rule, value, callback) => {
              if (/^(?:[0-9]\d*)$/.test(this.setlist[4].tmp_limit_2) == false) {
                callback(new Error("请输入正整数"));
              } else {
                callback();
              }
            },
            trigger: 'blur'
          }],

        },
        echartsdia: false,
        echartsdata: '',
        echarttime: [],
        mchsn: '',
      }
    },
    created() {
      this.Query(true)
    },
    methods: {
      getPickDate(pick) {
        this.pickDate = pick;
      },
      disabledDate(date) {
        const { minDate, maxDate } = this.pickDate;
        if (minDate && !maxDate) {
          const diff = Math.abs(minDate.valueOf() - date.valueOf());
          if (diff > 1000 * 3600 * 24 * 30) {
            return true;
          }
        }
      },
      Query(type) {
        if (type) {
          this.QueryForm.page = 1
        }
        this.Loading = true
        //this.$post('https://rk.shouhuojiyun.com/customer/compressor_tem/search_compressor_tem_alert', this.QueryForm).then((e) => {
        this.$post(this.$api + '/compressor_tem/search_compressor_tem_alert', this.QueryForm).then((e) => {
          if (e.code == 0) {
            this.list = e.rows
            this.QueryForm.total = e.total
            this.QueryForm.current = e.current
          }
          else
          {
            this.$notify({
              title: '失败',
              message: e.msg,
              type: 'error'
            });
          }
          this.Loading = false
        })
      },
      paramsetdialogfun() {
        this.paramsetdialog = true
        //this.$get('https://rk.shouhuojiyun.com/Customer/compressor_tem/get_mch_compressor_tem_alert_config').then((e) => {
        this.$get(this.$api + '/compressor_tem/get_mch_compressor_tem_alert_config').then((e) => {
          if (e.code == 0) {
            this.setlist = e.data
          }
          else
          {
            this.$notify({
              title: '失败',
              message: e.msg,
              type: 'error'
            });
          }
        })
      },
      saveset() {
        let param = {
          config: this.setlist
        }
        //this.$post('https://rk.shouhuojiyun.com/Customer/compressor_tem/set_mch_compressor_tem_alert_config', param).then((e) => {
        this.$post(this.$api + '/compressor_tem/set_mch_compressor_tem_alert_config', param).then((e) => {
          if (e.code == 0) {
            this.$notify({
              title: '成功',
              message: e.msg,
              type: 'success'
            });
          }
          else
          {
            this.$notify({
              title: '失败',
              message: e.msg,
              type: 'error'
            });
          }
          this.paramsetdialog = false
        })

      },
      showecharts(mchsn,mchid) {
        this.qdmchid = mchid
        this.qdmchsn = mchsn
        let param = ''
        if (mchsn != -1) {
          this.mchsn = mchsn
          param = {
            sn: mchsn,
            startdate: '',
            enddate: '',
          }
          this.echarttime = []
        }
        else
        {
          param = {
            sn: this.mchsn,
            startdate: this.echarttime[0],
            enddate: this.echarttime[1]
          }
        }
        this.echartsdia = true
        //this.$get('https://rk.shouhuojiyun.com/rk_bussiness/reko_statistics/get_mch_state_line', param).then((e) => {
        this.$get(this.$bussapi + '/reko_statistics/get_mch_state_line', param).then((e) => {
          if (e.code == 0) {

            this.echartsdata = e.data
            this.initecharts()
          }
          else
          {
            this.$notify({
              title: '失败',
              message: e.msg,
              type: 'error'
            });
          }
        })
      },
      initecharts() {
        const line2Chart = this.$echarts.init(document.getElementById('line1'));
        line2Chart.clear();
        line2Chart.off('click') // 如果不加off事件，就会叠加触发
        line2Chart.showLoading({
          text: '正在努力的读取数据中...'
        });
        const line2option = {
          title: {
            text: '温度曲线',
          },
          tooltip: {
            trigger: 'axis'
          },
          grid: {
            x: 50,
            x2: 20,
            y2: 70,
            containLabel: true
          },
          legend: {
            data: this.echartsdata.legend_data,
          },
          toolbox: {
            feature: {
              saveAsImage: {}
            }
          },
          xAxis: {
            type: 'category',
            boundaryGap: false,
            data: this.echartsdata.xAxis_data
          },
          yAxis: {
            type: 'value'
          },
          series: this.echartsdata.series_data
        };


        line2Chart.on('click', function (params) {
          console.log(params);
        })
        line2Chart.hideLoading()
        line2Chart.setOption(line2option);
      },
      handleSizeChange(v) {
        this.QueryForm.pagesize = v;
        this.Query()
      },
      handleCurrentChange(v) {
        this.QueryForm.page = v;
        this.Query()
      },
      stoptemcol() {
        this.$confirm('是否停止当前机器温控?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.$get(this.$bussapi + '/compressor_tem/stop_mch_strategy_tem?mch_id=' + this.qdmchid).then((e) => {
            if (e.code == 0) {
              this.$notify({
                title: '成功',
                message: e.msg,
                type: 'success'
              });
            }
            else
            {
              this.$notify({
                title: '失败',
                message: e.msg,
                type: 'error'
              });
            }
          })
        }).catch(() => {

        });
      }
    }
  }
</script>
<style scoped>
  .diatitle {
    font-size: 16px;
  }

  .top1smalltitle {
    margin-bottom: 5px;
  }

  .dialistitlte {
    margin-top: 20px;
    margin-bottom: 10px;
  }

  .positionbody {
    width: 175px;
    margin: 0 auto;
    height: 77px;
  }

  .listinput {
    width: 85px;
    float: left;
  }

  .listinput_word {
    float: left;
    line-height: 40px;
    text-align: left;
  }

  .listinput_word_left {
    padding-right: 5px;
  }

  .listinput_word_right {
    padding-left: 5px;
  }
</style>